/**
 * Created by Ysssssss on 2021/4/13.
 */

import React, { PureComponent } from 'react'
import {connect} from "react-redux";
import {getUserInfoInStore} from "@sagas/user";
import { getBrandInfoConfig } from "@routes/config";
import {renderRoutes} from "@routes/AppRouter";

@connect(state => ({
    userInfoInStore: state.user.userInfoInStore
}), {
    getUserInfoInStore,
})
class BrandInfoApp extends PureComponent {
    componentDidMount() {
        window.loadingRefs && window.loadingRefs.show()
        this.props.getUserInfoInStore(() => {
            window.loadingRefs && window.loadingRefs.hide()
        })
    }

    render () {
        const { userInfoInStore } = this.props
        const ele =  userInfoInStore ? renderRoutes(getBrandInfoConfig()) : null
        return ele
    }
}

export default BrandInfoApp